var dt = new Date();

function getDaysInOneMonth(year, month) {
	month = parseInt(month, 10);
	var d = new Date(year, month, 0);
	return d.getDate();
}

console.log(getDaysInOneMonth(2017, 1))